import { createWebHistory, createRouter } from "vue-router";
import type { App } from "vue";

import { coreRoutes, fallBackRoutes } from "./routes/core";
import { createRouterGuard } from "./guard";

const routes = [...coreRoutes, ...fallBackRoutes];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export function setupRouter(app: App<Element>) {
  createRouterGuard(router);
  app.use(router);
}

export default router;
